package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.domain.entity.Company;
import com.ruoyi.system.mapper.CompanyMapper;
import com.ruoyi.system.service.CompanyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: ruohao
 * @Date: 2023/9/3
 **/
@Service
public class CompanyServiceImpl implements CompanyService {
    @Resource
    private CompanyMapper companyMapper;

    @Override
    public List<Company> selectList(Company company) {
        return companyMapper.selectList(company);
    }

    @Override
    public Company selectById(Long id) {
        return companyMapper.selectById(id);
    }

    @Override
    public Boolean create(Company company) {
        return companyMapper.insert(company) == 1;
    }

    @Override
    public Boolean update(Company company) {
        return companyMapper.update(company) == 1;
    }

    @Override
    public Boolean deleteById(Long id) {
        return companyMapper.deleteById(id) == 1;
    }

    @Override
    public String getTypeByName(String companyName) {
        String type = "";
        type = companyMapper.getTypeByName(companyName);
        return type;
    }
}
